package org.dromara.oce.constant;

import lombok.Getter;
import org.dromara.common.core.domain.dto.TypeDto;

import java.math.BigDecimal;
import java.util.*;

/**
 * 推广链接类型枚举
 *
 * @author ruoyi
 */
public enum ReferralLinkType {
    REFERRAL_LINK_TYPE_SELF(1,"袋鼠"),
    REFERRAL_LINK_TYPE_FANQIE(2,"番茄"),
    REFERRAL_LINK_TYPE_DIANZHONG(3,"点众"),
    REFERRAL_LINK_TYPE_FANQIE_IAA(4,"番茄IAA"),
    REFERRAL_LINK_TYPE_DAISHU_IAA(5,"袋鼠IAA"),
    REFERRAL_LINK_TYPE_DOUYIN_ACCOUNT_IAP(6,"端原生IAP"),
    REFERRAL_LINK_TYPE_DOUYIN_ACCOUNT_IAA(7,"端原生IAA"),
    REFERRAL_LINK_TYPE_CHUAN_SHAN_JIA_IAA(8,"穿山甲IAA")


    ;




    @Getter
    private final Integer type;
    private final String desc;

    private ReferralLinkType(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }
    public static String getDescByType(int type) {
        for (ReferralLinkType e : ReferralLinkType.values()) {
            if (e.getType() == type) {
                return e.desc;
            }
        }
        return null;
    }

    public static List<TypeDto> getAllType() {
        List<TypeDto> types = new ArrayList<>();
        ReferralLinkType[] values = ReferralLinkType.class.getEnumConstants();
        for (ReferralLinkType value : values) {
            TypeDto map = new TypeDto();
            map.setType(value.type + "");
            map.setDesc(value.desc);
            types.add(map);
        }
        return types;
    }
}
